//
// Created by zhangyue26 on 2020/7/23.
//
#include <stdio.h>
/**
 * 指向指针的指针
 */
void pointForPoint1(){
    char *stringArr[] = {"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"};
    char **pString;
    for (int i = 0; i < 12; ++i) {
        printf("----------------------------------\n");
        printf("复制前：\n");
//        printf("stringArr为：%d\n", stringArr);
//        printf("*stringArr为：%s\n", *stringArr);
//        printf("pString为：%d\n", pString); //此时指针没有指向(赋值)，所以不能进行输出，当前值为NULL
//        printf("*pString为：%s\n", *pString);//此时指针没有指向(赋值)，所以不能进行输出，当前值为NULL
        pString = stringArr + i;
        printf("pString为：%d\n", pString);
        printf("*pString为：%s\n", *pString);
    }
    printf("************最后为:**********\n");
}
/**
 * 指向指针的指针2
 * 输出一位数组中偶数的元素，并统计偶数的个数
 */
void pointForPoint2(){
    int a[15] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14}, *p1, **p2, i, n = 0;
    p1 = a;
    p2 = &p1;
    printf("数组中的偶数为：\n");
    for (int i = 0; i < 15; ++i) {
        if (*(*p2 + i) % 2 == 0) {
            printf("%5d", *(*p2 + i));
            n++;
        }
    }
    printf("\n");
    printf("数组中偶数的个数：%d\n", n);

}